home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / facilis.zip / ZELLER.PAS < prev   
Pascal/Delphi Source File  |  1985-10-04  |  768b  |  39 lines

  1. program zeller(input, output);
  2. {$t+ }
  3. var     day, month, year,
  4.         zday, m, y1, y2 : integer;
  5.  
  6. begin
  7.    writeln('This program computes the day of the Week from the Date');
  8.    writeln;
  9.    write('Enter month:');
  10.    read(month);
  11.    writeln;
  12.    write('Enter day:');
  13.    read(day);
  14.    writeln;
  15.    write('Enter year:');
  16.    read(year);
  17.    if month < 3
  18.    then begin
  19.       m:=month + 10;
  20.       year:=year - 1
  21.    end else
  22.       m:=month - 2;
  23.  
  24.    y1:=year div 100;
  25.    y2:=year mod 100;
  26.  
  27.    zday:=(day + trunc(2.6*m - 0.1)
  28.               + y2 + y2 div 4
  29.                    + y1 div 4 - 2*y1 + 49) mod 7;
  30.  
  31.    writeln;
  32.    write('Day of the week (0=Sun, 6=Sat):',zday)
  33. end.
  34.  
  35. 4
  36.                    + y1 div 4 - 2*y1 + 49) mod 7;
  37.  
  38.    writeln;
  39.